package com.ionehe.group.common.uaa.ex.enums;

/**
 * Copyright (c) 2020 ionehe.com
 * Date: 2020/11/26 0026
 * Time: 16:39
 *
 * @author 2020年 <a href="mailto:a@ionehe.com">秀</a>
 */
public enum SetMealEnum {
    ONEMONTH(1,"一个月"),
    THREEMONTH(3,"三个月"),
    HALFONEYEAR(6,"半年"),
    ONEYEAR(12,"一年"),
    THREEYEAR(36,"三年"),
    FOREVER(10000,"永久");



    private Integer type;

    private String des;

    SetMealEnum(Integer type, String des){
        this.type = type;
        this.des = des;
    }

    public static String getValue(Integer type) {
        SetMealEnum[] setMealEnums = values();
        for (SetMealEnum setMealEnum : setMealEnums) {
            if (setMealEnum.type==type) {
                return setMealEnum.des;
            }
        }
        return null;
    }

    public static Integer getKey(String des) {
        SetMealEnum[] setMealEnums = values();
        for (SetMealEnum setMealEnum : setMealEnums) {
            if (setMealEnum.des.equals(des)) {
                return setMealEnum.type;
            }
        }
        return null;
    }

    public Integer getKey() {
        return type;
    }

    public String getDes() {
        return des;
    }

}
